package Dialog;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.Timer;
import javax.swing.border.EmptyBorder;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JLabel;

public class MessageInfo extends JDialog {
	private final JPanel contentPanel = new JPanel();
	private static boolean flag = true;

	public static void main(String[] args) {
		new MessageInfo();
	}

	Timer timer = null;

	public MessageInfo() {

		Toolkit kit = Toolkit.getDefaultToolkit();
		Dimension screenSize = kit.getScreenSize();
		final int screenWidth = screenSize.width;
		final int screenHeight = screenSize.height;
		final int messagewidth = 256;
		final int messageheight = 142;
		setBounds(screenWidth / 2 - (messagewidth / 2), screenHeight / 2
				- (messageheight / 2), messagewidth, messageheight);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(null);

		JLabel lblNewLabel = new JLabel("执行完毕");
		lblNewLabel.setBounds(30, 10, 200, 59);
		contentPanel.add(lblNewLabel);
		setVisible(true);
		timer = new Timer(1000, new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				setVisible(false);
				dispose();
				System.out.println("hello");
				timer.stop();
			}
		});
		timer.start();
	}
}
